﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Forget.HRBLL.Logical;

namespace HRWebSite.Sys
{
    public partial class DepartAdd : BasePage
    {
        protected override void Page_Load(object sender, EventArgs e)
        {
            this.HRLimits = Limits.DepartmentManage;
            this.HRLimitAttribute = Forget.HRBLL.LimitAttribute.Read | Forget.HRBLL.LimitAttribute.Add;
            base.Page_Load(sender, e);
        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            int parentID = int.Parse(this.Request.Params["iAddParentID"]);
            if (DepartmentLogical.AddDepartment(this.TextBox1.Text, parentID))
                Response.Write("<script>location='../sys/editorgstructure.aspx';</script>");
            else
                Response.Write("<script>alert('保存失败');location='../sys/editorgstructure.aspx';</script>");
        }
    }
}